var express = require('express');
var app = express();

var logger = require('./logger');
var client = require('./client');

// client.start(); // 启动微信token轮询

app.get('/token/refresh', async(req, res) => {
    logger.debug(`[index] req query: ${JSON.stringify(req.query)}`);
    let token = await client.refresh(req.query.token);
    logger.debug(`[index] token/refresh: ${JSON.stringify(token)}`);
    res.send(token);
});

app.listen(3000);

logger.debug('[index] express server started...');


// setTimeout(() => client.stop(), 10000);
